

<template>
  <div
    class="addGoods"
    @click="$router.push(`/goodsDetail?id=${addGoods.id}&productType=${addGoods.productType}`)"
  >
    <div class="shoppingShow">
      <img :src="addGoods.mainPic" class="goodsShow" />
      <div class="shoppingShowRight">
        <p class="goodsTitle">{{addGoods.productName}}</p>
        <span class="goodslabel">{{addGoods.productGrade}}级</span>
        <!-- <span class="goodslabel">{{addGoods.productOpenness}}度开放</span> -->
        <span class="goodslabel">{{addGoods.productLength}}</span>
        <span class="goodslabel">{{addGoods.color}}</span>
        <p class="goodsMarket">市场均价:￥{{addGoods.averagePrice}}元</p>
        <div class="shop_pic_box">
          <span class="goodsPrice">￥{{addGoods.productPrice}}元/束</span>
          <img
            src="../assets/images/add@2x.png"
            class="shoppingAdd"
            v-if="addGoods.productType == 1"
          />
          <span v-if="addGoods.productType == 2" class="goodsAuction">{{addGoods.purchaseMinNum}}束起团</span>
          <span v-if="addGoods.productType == 4" class="goodsGroup">参与竞拍</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/**
 * 搜索列表展示的商品组件
 * 如果在别的地方需要用也可以复用
 * 团购特价竞拍都可以支持
 * 通过传入的addGoods对象里的
 * productType (integer, optional): 产品类型1-普通商品；2-团购商品；3-特价商品；4-拍卖商品 ,
 */

export default {
  name: "goods-component",
  props: ["addGoods"],

  created() {
    console.log(this.addGoods.productType, "总金额");
  }
};
</script>

<style scoped>
.shop_pic_box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 15px;
}
.addGoods {
  background-color: rgba(247, 249, 252, 1);
  width: 100%;
  padding: 0 15px;
}
.shoppingShow {
  width: 100%;
  display: flex;
  /* text-align: center; */
  margin-top: 10px;
  background-color: #fff;
}
.shop_pic_box{
  display: inline-block;
}
.goodsShow {
  width: 112px;
  height: 112px;
  vertical-align: middle;
  margin-left: 9px;
  margin-top: 12px;
  flex: 0.5;
}
.shoppingShowRight {
  margin-left: 13px;
  vertical-align: middle;
  flex: 1;
}
.goodsTitle {
  font-size: 14px;
  font-weight: bold;
  color: rgba(51, 51, 51, 1);
  line-height: 18px;
  white-space: nowrap;
}
.goodslabel {
  background: #f7f9fc;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(169, 173, 191, 1);
  line-height: 18px;
  margin: 0 5px;
  padding: 2px;
  text-align: center;
}
.goodsMarket {
  margin-top: 8px;
  background: #fff0e6;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 97, 0, 1);
  text-align: center;
  width: 130px;
}
.goodsPrice {
  font-size: 18px;
  font-weight: bold;
  color: rgba(255, 98, 0, 1);
}
.shoppingAdd {
  width: 21px;
  height: 21px;
  vertical-align: middle;
  margin-left: 60px;
}
.goodsAuction{
  font-size: 12px;
  background: rgba(0, 198, 87, 1);
  border-radius: 5px;
  padding: 5px;
  color: #fff;
  margin-left: 10px;
}
.goodsGroup {
  font-size: 12px;
  background: rgba(0, 198, 87, 1);
  border-radius: 5px;
  padding: 5px;
  color: #fff;
  margin-left: 30px;
}
</style>
